package com.example.myapplication.widget

import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.myapplication.Greeting
import com.example.myapplication.ui.theme.MyApplicationTheme

@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
    MyApplicationTheme {
        Column() {

            Greeting("Android")
            Text("title")
            Text("context")
            Row() {


                Text("1")
                Spacer(Modifier.padding(horizontal = 8.dp)) // 添加一个空的控件用来填充水平间距，设置 padding 为 8.dp
                Text("2")
                Spacer(Modifier.padding(horizontal = 8.dp)) // 添加一个空的控件用来填充水平间距，设置 padding 为 8.dp
                Text("3")
            }
        }
    }
}

@Composable
fun HeadImageView(@DrawableRes id: Int){
    Image(
        painterResource(id = id),
        contentDescription = "profile picture", //这个描述用于无障碍
        modifier = Modifier.size(50.dp)
            .clip(CircleShape)
            .border(1.5.dp, Color.Yellow,shape = CircleShape)
    )

}